/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.event.util;

import java.util.List;

import ms.jasim.framework.IValueProvider;

import ms.jasim.model.ModelObject;
import ms.jasim.model.NamedModelObject;

import ms.jasim.model.event.*;

import ms.utils.INamedItem;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see ms.jasim.model.event.EventPackage
 * @generated
 */
public class EventSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static EventPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventSwitch() {
		if (modelPackage == null) {
			modelPackage = EventPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case EventPackage.EVENT_MODEL: {
				EventModel eventModel = (EventModel)theEObject;
				T result = caseEventModel(eventModel);
				if (result == null) result = caseModelObject(eventModel);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.EVENT_SET: {
				EventSet eventSet = (EventSet)theEObject;
				T result = caseEventSet(eventSet);
				if (result == null) result = caseNamedModelObject(eventSet);
				if (result == null) result = caseModelObject(eventSet);
				if (result == null) result = caseINamedItem(eventSet);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.EVENT: {
				Event event = (Event)theEObject;
				T result = caseEvent(event);
				if (result == null) result = caseNamedModelObject(event);
				if (result == null) result = caseModelObject(event);
				if (result == null) result = caseINamedItem(event);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.EVENT_PRECONDITION: {
				EventPrecondition eventPrecondition = (EventPrecondition)theEObject;
				T result = caseEventPrecondition(eventPrecondition);
				if (result == null) result = caseModelObject(eventPrecondition);
				if (result == null) result = caseIValueProvider(eventPrecondition);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.ABSOLUTE_TIME: {
				AbsoluteTime absoluteTime = (AbsoluteTime)theEObject;
				T result = caseAbsoluteTime(absoluteTime);
				if (result == null) result = caseEventPrecondition(absoluteTime);
				if (result == null) result = caseModelObject(absoluteTime);
				if (result == null) result = caseIValueProvider(absoluteTime);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.EVENT_RELATIVE_TIME: {
				EventRelativeTime eventRelativeTime = (EventRelativeTime)theEObject;
				T result = caseEventRelativeTime(eventRelativeTime);
				if (result == null) result = caseEventPrecondition(eventRelativeTime);
				if (result == null) result = caseModelObject(eventRelativeTime);
				if (result == null) result = caseIValueProvider(eventRelativeTime);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.ACTION_RELATIVE_TIME: {
				ActionRelativeTime actionRelativeTime = (ActionRelativeTime)theEObject;
				T result = caseActionRelativeTime(actionRelativeTime);
				if (result == null) result = caseEventPrecondition(actionRelativeTime);
				if (result == null) result = caseModelObject(actionRelativeTime);
				if (result == null) result = caseIValueProvider(actionRelativeTime);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.COMPOSITE_PRECONDITION: {
				CompositePrecondition compositePrecondition = (CompositePrecondition)theEObject;
				T result = caseCompositePrecondition(compositePrecondition);
				if (result == null) result = caseEventPrecondition(compositePrecondition);
				if (result == null) result = caseModelObject(compositePrecondition);
				if (result == null) result = caseIValueProvider(compositePrecondition);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.REACTION_LIST: {
				ReactionList reactionList = (ReactionList)theEObject;
				T result = caseReactionList(reactionList);
				if (result == null) result = caseNamedModelObject(reactionList);
				if (result == null) result = caseModelObject(reactionList);
				if (result == null) result = caseINamedItem(reactionList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.EVENT_REACTION: {
				EventReaction eventReaction = (EventReaction)theEObject;
				T result = caseEventReaction(eventReaction);
				if (result == null) result = caseNamedModelObject(eventReaction);
				if (result == null) result = caseModelObject(eventReaction);
				if (result == null) result = caseINamedItem(eventReaction);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.MODIFY_MODEL_REACTION: {
				ModifyModelReaction modifyModelReaction = (ModifyModelReaction)theEObject;
				T result = caseModifyModelReaction(modifyModelReaction);
				if (result == null) result = caseEventReaction(modifyModelReaction);
				if (result == null) result = caseNamedModelObject(modifyModelReaction);
				if (result == null) result = caseModelObject(modifyModelReaction);
				if (result == null) result = caseINamedItem(modifyModelReaction);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.MODIFY_OBJECT_REACTION: {
				ModifyObjectReaction modifyObjectReaction = (ModifyObjectReaction)theEObject;
				T result = caseModifyObjectReaction(modifyObjectReaction);
				if (result == null) result = caseEventReaction(modifyObjectReaction);
				if (result == null) result = caseNamedModelObject(modifyObjectReaction);
				if (result == null) result = caseModelObject(modifyObjectReaction);
				if (result == null) result = caseINamedItem(modifyObjectReaction);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.REPLAN_REACTION: {
				ReplanReaction replanReaction = (ReplanReaction)theEObject;
				T result = caseReplanReaction(replanReaction);
				if (result == null) result = caseEventReaction(replanReaction);
				if (result == null) result = caseNamedModelObject(replanReaction);
				if (result == null) result = caseModelObject(replanReaction);
				if (result == null) result = caseINamedItem(replanReaction);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.FOR_ALL_REACTION: {
				ForAllReaction forAllReaction = (ForAllReaction)theEObject;
				T result = caseForAllReaction(forAllReaction);
				if (result == null) result = caseReplanReaction(forAllReaction);
				if (result == null) result = caseEventReaction(forAllReaction);
				if (result == null) result = caseNamedModelObject(forAllReaction);
				if (result == null) result = caseModelObject(forAllReaction);
				if (result == null) result = caseINamedItem(forAllReaction);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.FOR_ALL_DOMAIN: {
				ForAllDomain forAllDomain = (ForAllDomain)theEObject;
				T result = caseForAllDomain(forAllDomain);
				if (result == null) result = caseModelObject(forAllDomain);
				if (result == null) result = caseIValueProvider(forAllDomain);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case EventPackage.FOR_ALL_GOAL_DOMAIN: {
				ForAllGoalDomain forAllGoalDomain = (ForAllGoalDomain)theEObject;
				T result = caseForAllGoalDomain(forAllGoalDomain);
				if (result == null) result = caseForAllDomain(forAllGoalDomain);
				if (result == null) result = caseModelObject(forAllGoalDomain);
				if (result == null) result = caseIValueProvider(forAllGoalDomain);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Model</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Model</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEventModel(EventModel object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Set</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Set</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEventSet(EventSet object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Event</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Event</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEvent(Event object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Precondition</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Precondition</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEventPrecondition(EventPrecondition object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Absolute Time</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Absolute Time</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAbsoluteTime(AbsoluteTime object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Relative Time</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Relative Time</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEventRelativeTime(EventRelativeTime object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Action Relative Time</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Action Relative Time</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActionRelativeTime(ActionRelativeTime object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Composite Precondition</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Composite Precondition</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCompositePrecondition(CompositePrecondition object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Reaction List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Reaction List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseReactionList(ReactionList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Reaction</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Reaction</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEventReaction(EventReaction object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Modify Model Reaction</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Modify Model Reaction</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseModifyModelReaction(ModifyModelReaction object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Modify Object Reaction</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Modify Object Reaction</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseModifyObjectReaction(ModifyObjectReaction object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Replan Reaction</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Replan Reaction</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseReplanReaction(ReplanReaction object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>For All Reaction</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>For All Reaction</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseForAllReaction(ForAllReaction object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>For All Domain</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>For All Domain</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseForAllDomain(ForAllDomain object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>For All Goal Domain</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>For All Goal Domain</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseForAllGoalDomain(ForAllGoalDomain object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseModelObject(ModelObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>INamed Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>INamed Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseINamedItem(INamedItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Named Model Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Named Model Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseNamedModelObject(NamedModelObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IValue Provider</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IValue Provider</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIValueProvider(IValueProvider object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //EventSwitch
